package com.googlecodes.tfhwiz.resourceutil;

import java.io.IOException;
/**
 * Resource loading manager.
 * simple implement
 *
 */
public class ResourceManager<R> {
    private ResourceLoader<R> loader;
    public ResourceManager<R> setResourceLoader(ResourceLoader<R> loader) {
        this.loader = loader;
        return this;
    }
    public ResourceLoader<R> getResourceLoader() {return loader;}

    /**
     * return resource
     * if isn't possible return null.
     *
     */
    public R getResource() {
        try {
            return loader.load();
        } catch (IOException e) {
            // TODO It's fine?
            return null;
        }
    }
}
